<include file="public@header"/>
<style type="text/css">
    .pic-list li {
        margin-bottom: 5px;
    }
</style>
<script type="text/html" id="photos-item-tpl">
    <li id="saved-image{id}">
        <input id="photo-{id}" type="hidden" name="TouchSlide[]" value="{filepath}">
        图片地址
        <input class="form-control" id="photo-{id}-name" type="text" name="photo_names[]" value="{name}"
               style="width: 200px;" title="图片名称">
        链接地址
        <input class="form-control" id="photo-{id}-link" type="text"
               name="photo_links[]" value=""
               style="width: 200px;" title="链接地址">
        <img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
             onclick="imagePreviewDialog(this.src);">
        <a href="javascript:uploadOneImage('图片上传','#photo-{id}');">替换</a>
        <a href="javascript:(function(){$('#saved-image{id}').remove();})();">移除</a>
    </li>
</script>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('AdminConfig/index')}">基础配置</a></li>
    </ul>
    <div class="row margin-top-20">
        <div class="col-md-2">
            <div class="list-group">
                <a class="list-group-item" href="#A" data-toggle="tab">轮播图设置</a>
                <a class="list-group-item" href="#B" data-toggle="tab">快讯设置</a>
                <a class="list-group-item" href="#C" data-toggle="tab">搜索关键字</a>
                <a class="list-group-item" href="#D" data-toggle="tab">其他信息</a>
            </div>
        </div>
        <div class="col-md-6">
            <form class="js-ajax-form" action="{:url('AdminConfig/editPost')}" method="post">
                <div class="tab-content">
                    <div class="tab-pane active" id="A">
                        <div class="form-group">
                            <label>轮播图</label>
                            <div>
                                <ul id="photos" class="pic-list list-unstyled form-inline">
                                    <notempty name="$data['TouchSlide']">
                                        <foreach name="$data['TouchSlide']" id="vo">
                                            <li id="saved-image{$key}">
                                                <input id="photo-{$key}" type="hidden" name="TouchSlide[]"
                                                       value="{$vo.url}">
                                                图片名称
                                                <input class="form-control" id="photo-{$key}-name" type="text"
                                                       name="photo_names[]" value="{$vo.alt}"
                                                       style="width: 200px;" title="图片名称">
                                                链接地址
                                                <input class="form-control" id="photo-{$key}-link" type="text"
                                                       name="photo_links[]" value="{$vo.link}"
                                                       style="width: 200px;" title="链接地址">
                                                <img id="photo-{$key}-preview" src="{:cmf_get_image_preview_url($vo['url'])}" style="height:36px;width:
                                                36px;"
                                                     onclick="imagePreviewDialog(this.src);">
                                                <a href="javascript:uploadOneImage('图片上传','#photo-{$key}');">替换</a>
                                                <a href="javascript:(function(){$('#saved-image{$key}').remove();})();">
                                                    移除</a>
                                            </li>
                                        </foreach>

                                    </notempty>
                                </ul>
                                <a href="javascript:uploadMultiImage('图片上传','#photos','photos-item-tpl');"
                                   class="btn btn-default btn-sm">选择图片</a>

                            </div>
                        </div>
                    </div>
                    <div class="tab-pane" id="B">
                        <div class="form-group">
                            <label >商城快讯:</label>
                            <div>
                                <textarea name="news"  cols="100" rows="5">{$data.news|default=''}</textarea><span class="form-required"> *一行代表一条</span>
                            </div>
                        </div>

                    </div>
                    <div class="tab-pane" id="C">
                        <div class="form-group">
                            <label>搜索关键字:</label>
                            <div>
                                <input type="text" class="form-control" name="search_keywords" value="{$data.search_keywords|default=''}"><span class="form-required"> *如有多个请用英文逗号(,)隔开</span>
                            </div>
                        </div>

                    </div>
                    <div class="tab-pane" id="D">
                        <div class="form-group">
                            <label>新品最多显示数量:</label>
                            <div>
                                <input type="text" class="form-control" name="new_goods_num" value="{$data.new_goods_num|default=10}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label>推荐最多显示数量:</label>
                            <div>
                                <input type="text" class="form-control" name="recommend_goods_num" value="{$data.recommend_goods_num|default=20}">
                            </div>
                        </div>

                    </div>
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
                    <a class="btn btn-default" href="{:url('AdminGoods/index')}">{:lang('BACK')}</a>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
</body>
</html>